package com.ruoyi.web.controller.footBall;

import com.ruoyi.common.constant.Constants;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.framework.web.service.SysLoginService;
import io.swagger.annotations.ApiResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

@RestController
@RequestMapping("/wxLogin")
public class WxLoginController {
    @Value("${wx.appid}")
    private String appId;

    @Value("${wx.secret}")
    private String appSecret;
    @Autowired
    private SysLoginService loginService;

//

    @PostMapping()
    public AjaxResult login(@RequestParam String code) {
        // 逻辑可以根据需要调整
        AjaxResult ajax = AjaxResult.success();


        // 生成令牌
        String token = loginService.wxLogin(code);
        ajax.put(Constants.TOKEN, token);

        return ajax;
    }

}
